﻿using System;
using System.Text;
using System.Text.RegularExpressions;

class ExtractEmail
{
    static void Main()
    {
        string text = "Static void Main() nakov@telerik.com. using System,nakov@gmail.com return";

        Console.WriteLine(ExtractEmails(text));
    }

    public static string ExtractEmails(string text)
    {
        Regex emailRegex = new Regex(@"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*",
            RegexOptions.IgnoreCase);
        MatchCollection emailMatches = emailRegex.Matches(text);

        StringBuilder sb = new StringBuilder();
        
        foreach (Match emailMatch in emailMatches)
        {
            sb.AppendLine(emailMatch.Value);
        }
        return sb.ToString();
    }
}